<?php
/**
 * The Imagess model class for abstracting operations to the Images Entity
 *
 */

class Buyers extends Zend_Db_Table
{
	protected $_name = 'buyers'; // The name of the database entity
    protected $_primary = 'ebayUid'; // The primary key associated with this table
	
	    //Declare the relational links to other Database entities
    protected $_referenceMap    = array(
        'User' => array(
            'columns'           => 'ebayUid',
            'refTableClass'     => 'Transactions',
            'refColumns'        => 'ebayUid'
        ),
		'Transactions' => array(
		'columns'           => 'tid',
		'refTableClass'     => 'Transactions',
		'refColumns'        => 'tid')
    );
	
	public function getByEbayUid($ebayUid)
	{
		$row = $this->fetchRow($this->select()->where('ebayUid = ?', $ebayUid));		
		return $row;
	}
	
	public function getByTid($tid)
	{
		// A call with zero should be never made, as some transactions don't have ID's
		if($tid == 0)
		{
			return false;
		}
		$row = $this->fetchRow($this->select()->where('tid = ?', $tid));		
		return $row;
	}
}